home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
mint
/
editors
/
mjovesrc.zoo
/
ctype.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-04
|
10KB
|
251 lines
/***************************************************************************
* This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne. JOVE *
* is provided to you without charge, and with no warranty. You may give *
* away copies of JOVE, including sources, provided that this notice is *
* included in all the files. *
***************************************************************************/
#include "jove.h"
#include "ctype.h"
const unsigned char *SyntaxTable = CharTable[FUNDAMENTAL]; /* Current table to use. */
#define cU C_UPPER /* Upper case */
#define cL C_LOWER /* Lower case */
#define cN C_DIGIT /* Numeric */
#define cP C_PUNCT /* Punctuation */
#define cC C_CTRL /* Control */
#define cW C_WORD /* Word */
#define cOp C_BRA /* Open Parenthesis */
#define cCl C_KET /* Close Parenthesis */
const unsigned char CharTable[NMAJORS][NCHARS] = {
/* FUNDAMENTAL mode */
{
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cP, cP, cP, cP, cP, cP, cP, cP,
cOp|cP, cCl|cP, cP, cP, cP, cP, cP, cP,
cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN,
cW|cN, cW|cN, cP, cP, cP, cP, cP, cP,
cP, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cOp|cP, cP, cCl|cP, cP, cP,
cP, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cOp|cP, cP, cCl|cP, cP, cC,
#ifdef IBMPC
0, cW|cL, 0, 0, cW|cL, 0, 0, 0, 0, 0, 0, 0, 0, 0, cW|cU, 0,
0, 0, 0, 0, cW|cL, 0, 0, 0, 0, cW|cU, cW|cU, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
#endif /* IBMPC */
#ifdef MAC /* See Inside Macintosh Vol One p. 247 */
cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cP, cP, cP, cP, cP, cP, cP, cP,
cP, cP, cP, cP, cP, cP, cW|cU, cW|cU,
cP, cP, cP, cP, cP, cW|cU, cW|cL, cW|cU,
cW|cU, cW|cL, cP, cP, cP, cW|cU, cW|cL, cW|cL,
cP, cP, cP, cP, cP, cP, cW|cU, cP,
cP, cP, cP, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cP, cP, cP, cP, cP, cP, cP, cP,
cW|cU, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
#endif /* MAC */
},
/* TEXT mode */
{
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cP, cP, cP, cP, cP, cP, cP, cP|cW,
cOp|cP, cCl|cP, cP, cP, cP, cP, cP, cP,
cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN,
cW|cN, cW|cN, cP, cP, cP, cP, cP, cP,
cP, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cOp|cP, cP, cCl|cP, cP, cP,
cP, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cOp|cP, cP, cCl|cP, cP, cC,
#ifdef IBMPC
0, cW|cL, 0, 0, cW|cL, 0, 0, 0, 0, 0, 0, 0, 0, 0, cW|cU, 0,
0, 0, 0, 0, cW|cL, 0, 0, 0, 0, cW|cU, cW|cU, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
#endif /* IBMPC */
#ifdef MAC /* See Inside Macintosh Vol One p. 247 */
cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cP, cP, cP, cP, cP, cP, cP, cP,
cP, cP, cP, cP, cP, cP, cW|cU, cW|cU,
cP, cP, cP, cP, cP, cW|cU, cW|cL, cW|cU,
cW|cU, cW|cL, cP, cP, cP, cW|cU, cW|cL, cW|cL,
cP, cP, cP, cP, cP, cP, cW|cU, cP,
cP, cP, cP, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cP, cP, cP, cP, cP, cP, cP, cP,
cW|cU, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
#endif /* MAC */
},
/* CMODE */
{
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cP, cP, cP, cP, cP|cW, cP, cP, cP,
cOp|cP, cCl|cP, cP, cP, cP, cP, cP, cP,
cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN,
cW|cN, cW|cN, cP, cP, cP, cP, cP, cP,
cP, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cOp|cP, cP, cCl|cP, cP, cP|cW,
cP, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cOp|cP, cP, cCl|cP, cP, cC,
#ifndef ASCII7
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#endif /* !ASCII7 */
},
/* LISP mode */
#ifdef LISP
{
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cC, cC, cC, cC, cC, cC, cC, cC,
cP, cW|cP, cP, cP, cW|cP, cW|cP, cW|cP, cP,
cOp|cP, cCl|cP, cW|cP, cW|cP, cP, cW|cP, cP, cW,
cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN, cW|cN,
cW|cN, cW|cN, cW|cP, cP, cW|cP, cW|cP, cW|cP, cW|cP,
cW|cP, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU, cW|cU,
cW|cU, cW|cU, cW|cU, cOp|cP, cP, cCl|cP, cW|cP, cW|cP,
cP, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL, cW|cL,
cW|cL, cW|cL, cW|cL, cOp|cW|cP, cW|cP, cCl|cW|cP, cW|cP, cW|cC,
#ifndef ASCII7
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#endif /* !ASCII7 */
},
#endif /* LISP */
};
#undef cU
#undef cL
#undef cN
#undef cP
#undef cC
#undef cW
#undef cOp
#undef cCl
int
ismword(c)
int c;
{
return ((CharTable[curbuf->b_major])[c]&(C_WORD));
}
/* Map lower case characters to upper case and the rest to themselves. */
const char RaiseTable[NCHARS] = {
'\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
'\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
'\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
'\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
'\040', '!', '"', '#', '$', '%', '&', '\'',
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K',